﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取传递的值 ,HTTP的Get方法:受浏览器地址长度的限制，看得见链接地址
        //LbQueryString.Text = "limit" + Request.QueryString["limit"] + 
        //  ",page="+Request["page"];
        //QueryString：从查询字符串中读取用户提交的数据
        //可以不用QueryString方法，实现的效果相同，利用了request对象，this索引的访问方式
        LbQueryString.Text = "limit" + Request.QueryString["limit"] + ",page=" + Request.QueryString["page"];

        //HTTP的post方法，看不到链接地址，浏览器地址长度很长
        LbForm.Text = Request.Form["TbUsername"];
        LbForm2.Text = Request.Form["username"] + "," + Request["submit"];

        //Server Variables
        foreach (var item in Request.ServerVariables.Keys)
        {
            LbServerVariables.Text += "Key:" + item + "<br>";
        }
        //查看服务器地址
        LbServerVariables.Text += "服务器地址：" + Request.ServerVariables["LOCAL_ADDR"] + "<br>";
        //查看服务器端口
        LbServerVariables.Text += "服务器端口：" + Request.ServerVariables["SERVER_PORT"] + "<br>";
        //查看客户端地址
        LbServerVariables.Text += "客户端地址：" + Request.ServerVariables["REMOTE_ADDR"] + "<br>";
        //查看客户端端口
        LbServerVariables.Text += "客户端端口：" + Request.ServerVariables["REMOTE_PORT"] + "<br>";

        //Browser
        LbBrowser.Text = "浏览器类型" + Request.Browser["Browser"] + ", 浏览器的版本号：" +
            Request.Browser.Version;

        Response.Write(Request.UserAgent + "<br>");
        Response.Write(Request.Cookies.Keys.Count + "<br><br>");
        //   Response.Write(Request.Cookies.Keys[0]+":"+
        //       Request.Cookies.Get("ASP.NET_SessionId").Value+"<br><br>");
    }
}